package com.his.his_system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * HIS用户表
 * @TableName dzm_his_member
 */
@TableName(value ="dzm_his_member")
@Data

public class DzmHisMember implements Serializable ,UserDetails {
    /**
     * 用户id
     */
    @TableId(type = IdType.AUTO)
    private Integer uid;

    /**
     * 登录名
     */
    private String userName;

    /**
     * 登录密码
     */
    private String password;

    @TableField(exist = false)
    private String newPassword;

    /**
     * 最后一次登录时间
     */
    private Object lastLoginTime;

    /**
     * 
     */
    private String lastLoginIp;

    /**
     * 注册时间
     */
    private Integer createTime;

    /**
     * 是否允许用户登录( 1 是  2否) 3 删除
     */
    private Integer status;

    /**
     * 医院id，用于区分用户类型及其医生所属诊所
     */
    private Integer pId;

    /**
     * 1,管理员，2，医生，3.护士，4，挂号员，5，收费员6，发药员，7，财务8，其他人员
     */
    private Integer type;

    /**
     * 科室id
     */
    private Integer departmentId;
    /**
     * 医生级别 0:其他  1:主治医师  2:副主任医师  3:主任医师  4:医士  5:医师  6:助理医师  7:实习医师  8:主管护师  9:护师  10:护士  11:医师助理  12:研究生  13:随访员 
     */
    private Integer rank;

    /**
     * 二维码标识
     */
    private Object qrid;

    /**
     * 用户授权登录openid
     */
    private String openid;

    /**
     * 用户余额
     */
    private BigDecimal moneyBalance;

    /**
     * 冻结中余额
     */
    private BigDecimal moneyLock;

    /**
     * 邀请码
     */
    private String recommentCode;

    /**
     * 修改时间
     */
    private Integer updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DzmHisMember other = (DzmHisMember) that;
        return (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
            && (this.getPassword() == null ? other.getPassword() == null : this.getPassword().equals(other.getPassword()))
            && (this.getLastLoginTime() == null ? other.getLastLoginTime() == null : this.getLastLoginTime().equals(other.getLastLoginTime()))
            && (this.getLastLoginIp() == null ? other.getLastLoginIp() == null : this.getLastLoginIp().equals(other.getLastLoginIp()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getPId() == null ? other.getPId() == null : this.getPId().equals(other.getPId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getDepartmentId() == null ? other.getDepartmentId() == null : this.getDepartmentId().equals(other.getDepartmentId()))
            && (this.getRank() == null ? other.getRank() == null : this.getRank().equals(other.getRank()))
            && (this.getQrid() == null ? other.getQrid() == null : this.getQrid().equals(other.getQrid()))
            && (this.getOpenid() == null ? other.getOpenid() == null : this.getOpenid().equals(other.getOpenid()))
            && (this.getMoneyBalance() == null ? other.getMoneyBalance() == null : this.getMoneyBalance().equals(other.getMoneyBalance()))
            && (this.getMoneyLock() == null ? other.getMoneyLock() == null : this.getMoneyLock().equals(other.getMoneyLock()))
            && (this.getRecommentCode() == null ? other.getRecommentCode() == null : this.getRecommentCode().equals(other.getRecommentCode()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getPassword() == null) ? 0 : getPassword().hashCode());
        result = prime * result + ((getLastLoginTime() == null) ? 0 : getLastLoginTime().hashCode());
        result = prime * result + ((getLastLoginIp() == null) ? 0 : getLastLoginIp().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getPId() == null) ? 0 : getPId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getDepartmentId() == null) ? 0 : getDepartmentId().hashCode());
        result = prime * result + ((getRank() == null) ? 0 : getRank().hashCode());
        result = prime * result + ((getQrid() == null) ? 0 : getQrid().hashCode());
        result = prime * result + ((getOpenid() == null) ? 0 : getOpenid().hashCode());
        result = prime * result + ((getMoneyBalance() == null) ? 0 : getMoneyBalance().hashCode());
        result = prime * result + ((getMoneyLock() == null) ? 0 : getMoneyLock().hashCode());
        result = prime * result + ((getRecommentCode() == null) ? 0 : getRecommentCode().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", uid=").append(uid);
        sb.append(", userName=").append(userName);
        sb.append(", password=").append(password);
        sb.append(", lastLoginTime=").append(lastLoginTime);
        sb.append(", lastLoginIp=").append(lastLoginIp);
        sb.append(", createTime=").append(createTime);
        sb.append(", status=").append(status);
        sb.append(", pId=").append(pId);
        sb.append(", type=").append(type);
        sb.append(", departmentId=").append(departmentId);
        sb.append(", rank=").append(rank);
        sb.append(", qrid=").append(qrid);
        sb.append(", openid=").append(openid);
        sb.append(", moneyBalance=").append(moneyBalance);
        sb.append(", moneyLock=").append(moneyLock);
        sb.append(", recommentCode=").append(recommentCode);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public String getUsername() {
        return this.userName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}